# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=pcapxray
pkgver=274.1721645
pkgrel=6
pkgdesc='A Network Forensics Tool - To visualize a Packet Capture offline as a Network Diagram including device identification, highlight important communication and file extraction.'
groups=('blackarch' 'blackarch-forensic' 'blackarch-networking')
arch=('any')
url='https://github.com/Srinivas11789/PcapXray'
license=('MIT')
depends=('python' 'python-networkx' 'python-netaddr' 'python-ipwhois' 'tk'
         'python-pillow6' 'python-stem' 'python-matplotlib' 'python-pyvis'
         'python-graphviz' 'python-pyshark' 'python-cryptography' 'scapy')
makedepends=('git')
source=("$pkgname::git+https://github.com/Srinivas11789/PcapXray.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  rm README.md LICENSE

  cp -a * "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname/Source
exec python main.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

